<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>主面板</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
    <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
</head>
<style>
    .layui-top-box {
        padding: 40px 20px 20px 20px;
        color: #fff
    }

    .panel {
        margin-bottom: 17px;
        background-color: #fff;
        border: 1px solid transparent;
        border-radius: 3px;
        -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
        box-shadow: 0 1px 1px rgba(0, 0, 0, .05)
    }

    .panel-body {
        padding: 15px
    }

    .panel-title {
        margin-top: 0;
        margin-bottom: 0;
        font-size: 14px;
        color: inherit
    }

    .label {
        display: inline;
        padding: .2em .6em .3em;
        font-size: 75%;
        font-weight: 700;
        line-height: 1;
        color: #fff;
        text-align: center;
        white-space: nowrap;
        vertical-align: baseline;
        border-radius: .25em;
        margin-top: .3em;
    }

    .layui-red {
        color: red
    }

    .main_btn > p {
        height: 40px;
    }
</style>
<body>
<div class="layuimini-container">
    <div class="layuimini-main layui-top-box">
        <div class="layui-row layui-col-space10">

            <div class="layui-col-md2">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-cyan">
                        <div class="panel-body">
                            <div class="panel-title">
                                <span class="label pull-right layui-bg-blue">实时</span>
                                <h5>用户统计</h5>
                            </div>
                            <div class="panel-content">
                                <h1 class="no-margins UserCount"></h1>
                                <div class="stat-percent font-bold text-gray"><i class="fa fa-users"></i><span
                                        class="UserCount"></span>
                                </div>
                                <small>当前总用户数</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-col-md2">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-blue">
                        <div class="panel-body">
                            <div class="panel-title">
                                <span class="label pull-right layui-bg-cyan">实时</span>
                                <h5>文章统计</h5>
                            </div>
                            <div class="panel-content">
                                <h1 class="no-margins ArticleCount"></h1>
                                <div class="stat-percent font-bold text-gray"><i class="fa fa-file-text-o"></i> <span
                                        class="ArticleCount"></span>
                                </div>
                                <small>当前总文章数</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-col-md2">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-green">
                        <div class="panel-body">
                            <div class="panel-title">
                                <span class="label pull-right layui-bg-orange">实时</span>
                                <h5>题目统计</h5>
                            </div>
                            <div class="panel-content">
                                <h1 class="no-margins ProblemCount"></h1>
                                <div class="stat-percent font-bold text-gray"><i class="fa fa-folder-open-o"></i> <span
                                        class="ProblemCount"></span>
                                </div>
                                <small>当前总题目数</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-col-md2">
                <div class="col-xs-6 col-md-3">
                    <div class="panel layui-bg-red">
                        <div class="panel-body">
                            <div class="panel-title">
                                <span class="label pull-right layui-bg-orange">实时</span>
                                <h5>竞赛统计</h5>
                            </div>
                            <div class="panel-content">
                                <h1 class="no-margins ContestCount"></h1>
                                <div class="stat-percent font-bold text-gray"><i class="fa fa-file-image-o"></i> <span
                                        class="ContestCount"></span>
                                </div>
                                <small>当前竞赛数</small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <div class="layui-box">
            <div class="layui-row layui-col-space10">
                <div class="layui-col-md6">
                    <!--<img src="https://www.ipip5.com/ipimg/" style="width: 750px;height: 400px">-->
                </div>
            </div>
        </div>
    </div>
    <script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script>
        $.ajax({
            url: "/admin/count",  //请求地址
            dataType: "json",  //数据格式
            type: "GET",  //请求方式
            async: false,
            success: function (data) {
                $(".UserCount").html(data.data.UserCount);
                $(".ArticleCount").html(data.data.ArticleCount);
                $(".ProblemCount").html(data.data.ProblemCount);
                $(".ContestCount").html(data.data.ContestCount);
            },
            error: function (data) {
                layer.msg("服务异常，请联系管理员");
            }

        });
    </script>
</div>
</body>
</html>
